<?php
/*
 * 
 * 

1. 二级域名

   a) 分组功能
   
   b) 单独页面的域名指向
   
		  class IndexAction extends HomeAction {
			
			
			// 主页面做二级域名路由
			public function index(){
				$sUrl = f_getCurUrl();
				$aUrl = parse_url($sUrl);
				if ($aUrl['host'] == 'fl.4318.com'){ // 返利首页
					if ($aUrl['path'] == '/' || $aUrl['path'] == '/index.php'){
						R('Fanli/index');
						return false;
					}
				} else if ($aUrl['host'] == 'xz.4318.com'){ // 下载页
					if ($aUrl['path'] == '/' || $aUrl['path'] == '/index.php'){
						R('Fanli/index');
						return false;
					}
				}
				$this->homes();
			}
			
			// 系统首页
			private function homes(){
				
			}
		}
		
		// 获取当前访问的完整url地址
		function f_getCurUrl(){
			$url='http://';
			if(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']=='on'){
				$url='https://';
			}
			
			if (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false){
				if($_SERVER['SERVER_PORT']!='80'){
					$url.=$_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
				}else{
					$url.=$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
				}
			} else {
				if($_SERVER['SERVER_PORT']!='80'){
					$url.=$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
				}else{
					$url.=$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
				}
			}
			return $url;
		}
	
2 二级页面 session 共享
	
	a)  index.php  配置 
    
		define('DOMAIN','4318.com');
		ini_set('session.cookie_path', '/');
		ini_set('session.cookie_domain', DOMAIN);
		
	b)  配置文件配置
	
	    'SESSION_OPTIONS' => array('domain'=>'.4318.com'),
	    'COOKIE_DOMAIN' => '.4318.com',
	
	